package thead;
// 实现 Runnable 接口 从写run方法
class MyRunnable implements Runnable {

    @Override
    public void run() {
        while(true) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("hello thread");
        }
    }
}
public class Demo2 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new MyRunnable());
        thread.start();
        while(true) {
            Thread.sleep(1000);
            System.out.println("hello mian");
        }
    }
}
